#include<iostream>
using namespace std;
const int N = 110;
int arr[N];
int n;
int main()
{
	cin >> n;
	int sum = 0;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		sum += arr[i];
	}
	int avg = sum / n;
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (arr[i] != avg) {
			arr[i + 1] += arr[i] - avg;
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}